﻿using Shop.RemoteModel.FrontCategory;
using Shop.RemoteModel.FrontCategory.Model;
using Shop.Service.Interface;
using WeDonekRpc.Client.Interface;

namespace Shop.Service.RpcEvent
{
    internal class FrontCategoryEvent : IRpcApiService
    {
        private readonly IFrontCategoryService _Service;

        public FrontCategoryEvent (IFrontCategoryService service)
        {
            this._Service = service;
        }

        public long AddFrontCategory (AddFrontCategory add)
        {
            return this._Service.Add(add.Datum);
        }
        public bool SetFrontCategory (SetFrontCategory set)
        {
            return this._Service.Set(set.Id, set.Datum);
        }
        public void DeleteFrontCategory (DeleteFrontCategory obj)
        {
            this._Service.Delete(obj.Id);
        }
        public void DisableFrontCategory (DisableFrontCategory obj)
        {
            this._Service.Disable(obj.Id);
        }
        public void EnableFrontCategory (EnableFrontCategory obj)
        {
            this._Service.Enable(obj.Id);
        }
        public FrontCategoryDatum GetFrontCategory (GetFrontCategory obj)
        {
            return this._Service.Get(obj.Id);
        }
        public FrontCategoryTree[] GetFrontCategoryTree (GetFrontCategoryTree obj)
        {
            return this._Service.GetTree(obj.Query);
        }
        public FrontCategoryFullTree[] GetFrontCategoryFullTree ()
        {
            return this._Service.GetFullTree();
        }
        public Dictionary<long, int> SetFrontCategorySort (SetFrontCategorySort obj)
        {
            return this._Service.SetSort(obj.Id, obj.Sort);
        }
        public void MoveFrontCategory (MoveFrontCategory obj)
        {
            this._Service.Move(obj.Id, obj.ToId);
        }
    }
}
